<ui:composition 
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    xmlns:composite="http://java.sun.com/jsf/composite">
    <composite:interface>
        <composite:attribute name="label"/>
        <composite:attribute name="value"/>
        <composite:attribute name="requiredMessage"/>
        <composite:attribute name="required"/>
        <composite:attribute name="pattern"/>
        <composite:attribute name="changeYear" default="true"/>
        <composite:attribute name="changeMonth" default="false"/>
    </composite:interface>

    <composite:implementation>
        <c:set var="pattern" value="#{cc.attrs.pattern}"/>
        <c:if test="#{empty cc.attrs.pattern}">
            <c:set var="pattern" value="#{deltasetConfig['dateFormat']}"/>
        </c:if>
        <c:if test="#{empty pattern}">
            <c:set var="pattern" value="dd-MM-yyyy"/>
        </c:if>
        <h:outputLabel for="inputField" value="#{cc.attrs.label}:" styleClass="ds-label"/>
        <h:inputText id="inputField" value="#{cc.attrs.value}" title="#{cc.attrs.label}"
                     requiredMessage="#{cc.attrs.requiredMessage}"
                     required="#{cc.attrs.required}"
                     styleClass="ui-widget-content ui-corner-all ds-datepicker ds-field">
            <f:convertDateTime pattern="#{pattern}"/>
        </h:inputText>
        <h:message id="errorMessage" for="inputField" errorClass="ui-state-error ui-state-error-text ds-message" />
        <script type="text/javascript">deltaset.decorateIfError('#{cc.clientId}');</script>
        <script type="text/javascript">deltaset.datePicker('#{cc.clientId}:inputField','#{pattern}',#{cc.attrs.changeYear},#{cc.attrs.changeMonth});</script>
    </composite:implementation>    
</ui:composition>